package bean;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;

import java.util.Date;

@Data
public class User {
    private String userName;

    private String password;

    @Setter(AccessLevel.NONE)
    private long registrationTime;

    {
        System.out.println("新用户注册");
        registrationTime = new Date().getTime();
    }

    public User() {

        userName = String.valueOf(registrationTime);
        password = "123456";
    }

    public User(String userName, String password) {
        this.userName = userName;
        this.password = password;
    }

    public String getInfo() {
        return this.toString();
    }

    @Override
    public String toString() {
        return "User{" +
                "userName='" + userName + '\'' +
                ", password='" + password + '\'' +
                ", registrationTime=" + registrationTime +
                '}';
    }
}
